package com.example.environment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.environment.pojo.City;
import com.example.environment.pojo.Feedback;
import com.example.environment.pojo.Supervisor;
import com.example.environment.pojo.mapper.CityMapper;
import com.example.environment.pojo.mapper.FeedbackMapper;
import com.example.environment.service.CityService;
import com.example.environment.service.FeedbackService;
import com.example.environment.tools.common.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements CityService {
    @Autowired
    private CityMapper cityMapper;
    @Override
    public ResultMsg getCityByProvince(Integer province_id) {
        QueryWrapper<City> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("province_id", province_id);
        List<City> cityList = cityMapper.selectList(queryWrapper); // 调用 getOne 方法
        System.out.println(cityList);
        if (cityList== null) {
            return ResultMsg.failOp("没有查询到省的下属市");
        }
        return ResultMsg.successOp(cityList);
    }
}
